<?php

use think\migration\Seeder;

class User extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $password = '123456';
        $salt = random(16,0);
        $this->table('user')->insert([
            'username' => 'root',
            'nickname' => '超级管理员',
            'password' => md5(md5($password).$salt),
            'salt' => $salt,
            'status' => 1,
            'last_login_time' => date('Y-m-d H:i:s'),
            'last_login_ip' => get_client_ip(),
            'create_user' => 1,
            'update_user' => 1,
            'create_time' => date('Y-m-d H:i:s'),
            'update_time' => date('Y-m-d H:i:s'),
        ])->save();
    }
}